package com;

import java.math.BigDecimal;

public class money {

    //余额
    public BigDecimal ye = new BigDecimal(32849);

    //月供
    public final BigDecimal yg = new BigDecimal(3924);

    //公积金月缴
    public final BigDecimal gjjJn = new BigDecimal(1500);

    public static void main(String[] args) {
        money mo = new money();
        mo.run();
        mo.run2();
    }

    public void run(){
        int month = 1;
        //余额大于月供可以继续
        while (ye.compareTo(yg) == 1){
            //余额减月供  次余额
            ye = ye.subtract(yg).add(gjjJn);
            month++;
        }
        System.err.println("公积金可以缴纳:"+month+"个月；还剩多少公积金余额:"+ye);
    }


    public void run2(){
        int month = 12;
        BigDecimal money = BigDecimal.ZERO;
        for(int i=1;i<=month;i++){
            money = money.add(yg.subtract(gjjJn));
        }
        System.err.println("每年需要缴纳:"+money+"钱");
    }


}
